package team.nmsg.ge.system.init.shiro;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

import org.apache.shiro.session.Session;
import org.apache.shiro.session.SessionListenerAdapter;
import org.springframework.web.servlet.i18n.SessionLocaleResolver;

import team.nmsg.ge.system.util.ServerConstants;
import team.nmsg.ge.system.util.ServerParams;

public class SysShiroSessionListener extends SessionListenerAdapter {

	private static Map<String, HttpSession> keyToSession = new HashMap<String, HttpSession>();
	
	//////////////////////以下方法生效////////////////////////
	
	 @Override    
     public void onStart(Session session) {//会话创建时触发    
		 session.setAttribute(SessionLocaleResolver.LOCALE_SESSION_ATTRIBUTE_NAME,  ServerParams.locale); 
		 super.onStart(session);
     }    
	 
     @Override    
     public void onExpiration(Session session) {//会话过期时触发    
    	 super.onExpiration(session);
    	 Serializable id = session.getId();
    	 String strSid = id.toString();
    	 
     }    
     
     @Override    
     public void onStop(Session session) {//退出时触发    
    	 super.onStart(session);
     }      
	
}